const menuBtn = document.querySelector(".header .fa-bars");
const nav = document.querySelector('.header .nav-list');

const init = function () {
    setFontSize();
    bindEvent();
}
function bindEvent() {
    window.addEventListener('resize', setFontSize, false);
    menuBtn.addEventListener('click', showNav, false);
}
function showNav() {

    let isShow=nav.style.display
    if (isShow === 'block'){
        nav.style.display='none'
    }else{
        nav.style.display='block'
    }
}
function setFontSize() {
    let cWidth = document.documentElement.clientWidth
    if (cWidth <= 414) {
        document.documentElement.style.fontSize = cWidth / 37.5 + 'px'
    } else {
        const fontSize = document.documentElement.style.fontSize
        if (fontSize !== '62.5%') {
            document.documentElement.style.fontSize = '62.5%'
        }
    }
}
init()